package com.googlecode.battleofendor;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

import com.googlecode.battleofendor.jme.BattleOfEndor;
import com.googlecode.battleofendor.synchroniation.HostPlayer;
import com.googlecode.battleofendor.synchroniation.SocketConnection;
import com.jme.app.AbstractGame.ConfigShowMode;

public class HostLauncher {

	public static void main(String[] args) throws IOException {
		HostPlayer host = new HostPlayer();
		
		System.out.println("Host waiting for sockets.");
		ServerSocket server = new ServerSocket(50000);
		
		Socket sock = server.accept();
		System.out.println("Host has got a socket.");
		
		BattleOfEndor game = new BattleOfEndor(host);
		game.setConfigShowMode(ConfigShowMode.NeverShow);
		host.setSceneGraph(game.getSceneGraph());
		
		host.addConnection(new SocketConnection(sock));
		game.start();
	}

}
